	import java.util.ArrayList;
	import java.util.List;

	public class TypeControl {

	    private static TypeControl instance;
	    private List<ICommand> listCommand;

	    public List<ICommand> getListCommand() {
	        return listCommand;
	    }

	    private TypeControl() {
	        listCommand = new ArrayList<>();
	        listCommand.add(new Exit());
	        listCommand.add(new ListBookControl());
	        listCommand.add(new FileBookControl());
		       
	       	        
	    }

	    public static TypeControl getInstance() {
	        if (instance == null) {
	            instance = new TypeControl();
	        }
	        return instance;
	    }

	    public void execute(String... args) {
	    	 boolean flag = true;
	         for (String com : args) {
	             for (ICommand command : listCommand) {
	                 if (command.name().equalsIgnoreCase(com)) {
	                     command.execute(args);
	                     flag = false;
	                 }
	             }
	             if (flag) {
	                 System.out.println("repository not found");
	                 for (ICommand command : listCommand){
	                	 System.out.println(command.name() + " : " + command.info() );
	                 }
	                 
	                 
	             }
	        
	    }
	  }
	}

